<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MyTestPilotCardUI</title>

<link rel="stylesheet" href="../../../main/css/style.css">
<link rel="stylesheet" href="../../../main/css/PilotCardUI.css">

<script src="../../../main/js/util/JavaScriptAugments.js"></script>
<script src="../../../main/js/util/Logger.js"></script>
<script src="../../../main/js/util/InputValidator.js"></script>
<script src="../../../main/js/util/ArrayUtilities.js"></script>

<script src="../../../main/js/Team.js"></script>
<script src="../../../main/js/Maneuver.js"></script>
<script src="../../../main/js/ShipAction.js"></script>
<script src="../../../main/js/Ship.js"></script>
<script src="../../../main/js/RangeRuler.js"></script>
<script src="../../../main/js/Weapon.js"></script>
<script src="../../../main/js/Pilot.js"></script>
<script src="../../../main/js/DamageCard.js"></script>
<script src="../../../main/js/Token.js"></script>
<script src="../../../main/js/SquadBuilder.js"></script>
<script src="../../../main/js/SimpleAgent.js"></script>

<script src="../../../main/js/ui/ImageUtilities.js"></script>
<script src="../../../main/js/ui/HumanAgent.js"></script>
<script src="../../../main/js/ui/PilotCardUI.js"></script>

</head>
<body>
	<table>
		<tr>
			<td id="imperialPilot" style="vertical-align: top">Imperial
				Pilot</td>

			<td id="rebelPilot" style="vertical-align: top">Rebel Pilot</td>
		</tr>
		<tr>
			<td><button type="button" onclick="updateImperialToken();">Update</button>
			<td><button type="button" onclick="updateRebelToken()">Update</button>
		</tr>
	</table>
	<script>
        var LOGGER = new Logger();
        var imageUtils = new ImageUtilities();

        var imperialAgent = new SimpleAgent("Imperial Agent", Team.IMPERIAL,
                CoreSetImperialSquadBuilder);
        var imperialToken = new Token(Pilot.ACADEMY_PILOT, imperialAgent);
        imperialToken.increaseCloakCount();
        imperialToken.increaseEvadeCount();
        imperialToken.increaseFocusCount();
        var imperialPilotCardUI = new PilotCardUI(imperialToken, imageUtils);
        var component = document.getElementById("imperialPilot");
        component.innerHTML = imperialPilotCardUI.paintComponent();

        var rebelAgent = new HumanAgent("Rebel Agent", Team.REBEL,
                CoreSetRebelSquadBuilder, new ImageUtilities());
        var rebelToken = new Token(Pilot.ROOKIE_PILOT, rebelAgent);
        rebelToken.increaseIonCount();
        rebelToken.increaseStressCount();
        var rebelPilotCardUI = new PilotCardUI(rebelToken, imageUtils);
        var component = document.getElementById("rebelPilot");
        component.innerHTML = rebelPilotCardUI.paintComponent();

        function updateImperialToken()
        {
            LOGGER.info("updateImperialToken() start");
            imperialToken.addDamage(DamageCard.DIRECT_HIT);
            imperialToken.addCriticalDamage(DamageCard.BLINDED_PILOT);
            imperialPilotCardUI.updateComponent();
            LOGGER.info("updateImperialToken() end");
        }

        function updateRebelToken()
        {
            LOGGER.info("updateRebelToken() start");
            rebelToken.addDamage(DamageCard.DIRECT_HIT);
            rebelToken.addCriticalDamage(DamageCard.BLINDED_PILOT);
            rebelPilotCardUI.updateComponent();
            LOGGER.info("updateRebelToken() end");
        }
    </script>
</body>
</html>
